package com.kscrm.web.service.impl;

import java.util.List;

import com.kscrm.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.kscrm.web.mapper.AccountMapper;
import com.kscrm.web.domain.Account;
import com.kscrm.web.service.IAccountService;

/**
 * 收款账户Service业务层处理
 * 
 * @author Dhq
 * @date 2025-04-08
 */
@Service
public class AccountServiceImpl implements IAccountService 
{
    @Autowired
    private AccountMapper accountMapper;

    /**
     * 查询收款账户
     * 
     * @param id 收款账户主键
     * @return 收款账户
     */
    @Override
    public Account selectAccountById(Long id)
    {
        return accountMapper.selectAccountById(id);
    }

    /**
     * 查询收款账户列表
     * 
     * @param account 收款账户
     * @return 收款账户
     */
    @Override
    public List<Account> selectAccountList(Account account)
    {
        return accountMapper.selectAccountList(account);
    }

    /**
     * 新增收款账户
     * 
     * @param account 收款账户
     * @return 结果
     */
    @Override
    public int insertAccount(Account account)
    {
        account.setUserId(SecurityUtils.getUserId());
        return accountMapper.insertAccount(account);
    }

    /**
     * 修改收款账户
     * 
     * @param account 收款账户
     * @return 结果
     */
    @Override
    public int updateAccount(Account account)
    {
        return accountMapper.updateAccount(account);
    }

    /**
     * 批量删除收款账户
     * 
     * @param ids 需要删除的收款账户主键
     * @return 结果
     */
    @Override
    public int deleteAccountByIds(Long[] ids)
    {
        return accountMapper.deleteAccountByIds(ids);
    }

    /**
     * 删除收款账户信息
     * 
     * @param id 收款账户主键
     * @return 结果
     */
    @Override
    public int deleteAccountById(Long id)
    {
        return accountMapper.deleteAccountById(id);
    }
}
